package com.ciwong.mobilelib.utils;

import com.ciwong.libs.utils.volley.BaseRequest;
import com.ciwong.mobilelib.application.BaseApplication;

/**
 * Action
 *
 * @author bin
 * @version ciwong v.1.0 2015/7/24 16:13
 * @since ciwong v.1.0
 */
public class EAction implements BaseRequest.CWAction {
    /**
     * 登录基础信息站点(获取token，验证密码、修改密码、修改用户信息)
     */
    public static String BASE_HOST = getHost() + "/gateway";

    /**
     * 接口站点
     */
    public static String HOST = getHost() + "/gateway";

    public static String H5_RESOURCE_UPDATE_URL = getHost() + "/gateway";

    /**
     * 应用更新URL
     */
    public static String UPGRADE_URL = "http://eapi.ciwong.com/repos/570678344/android/update";

//    static {
//        String host = LocalConfigUtils.getUrl("BASE_HOST",
//                BaseSystem.PROJECT_FOLDER);
//        if (host != null && !"".equals(host)) {
//            BASE_HOST = host;
//        }
//        host = LocalConfigUtils.getUrl("MY_APP_HOST",
//                BaseSystem.PROJECT_FOLDER);
//        if (host != null && !"".equals(host)) {
//            HOST = host;
//        }
//    }

    @Override
    public String getActionUrl(String s) {
        return null;
    }

    /**
     * 获取应用更新URL地址
     *
     * @return URL地址
     */
    public static String getUpgradeUrl() {
        return UPGRADE_URL;
    }

    public static String getHost() {
        String host = "";
        if (BaseApplication.RUN_ENV == 1) {// 1,开发环境
        } else if (BaseApplication.RUN_ENV == 2) {// 2，测试环境；
            host = "http://eapi.jiaofucloud.cn";
        } else if (BaseApplication.RUN_ENV == 3) { //3，预发布环境；
            host = "http://eapi.prev.ciwong.com";
        } else if (BaseApplication.RUN_ENV == 4) {// 4，正式环境。
            host = "https://eapi.ciwong.com";
        }
        return host;
    }

    /**
     * 获取离线包信息列表(zip包)
     *
     * @return
     */
    public static String getH5Update() {
        String h5_update_version = "v1807_2_8";
        String url = "";
        if (BaseApplication.RUN_ENV == 1) {// 1,开发环境

        } else if (BaseApplication.RUN_ENV == 2) {// 2，测试环境；
            url = "/v1/repos/hybrid/" + h5_update_version;
        } else if (BaseApplication.RUN_ENV == 3) { //3，预发布环境；
            url = "/v1/repos/hybrid/" + h5_update_version + "P";
        } else if (BaseApplication.RUN_ENV == 4) {// 4，正式环境。
            url = "/v1/repos/hybrid/" + h5_update_version;
        }
        return url;
    }


}
